import {
  Slider,
  Input, Switch, Color, selectPageVarAndCustom, Select, Extend, Area
} from '@/components/CustomPage/fields/widget'
import { labelOptions } from '@/components/CustomPage/apps/map/labelOps'
export function resourcesOptions() {
  return [
    {
      type: Select,
      option: {
        label: '资源类型',
        name: 'resource',
        list: [
          { name: '活动', value: 'hd' },
          { name: '人物（劳模工匠）', value: 'lmgj' },
          { name: '人物（大师）', value: 'ds' },
          { name: '人物（讲师）', value: 'js' },
          { name: '新闻', value: 'xw' },
          { name: '直播', value: 'zb' },
          { name: '闯关', value: 'cg' },
          { name: '专区', value: 'zq' },
          { name: '图片', value: 'tp' }
        ],
        value: 'hd',
        override: function(ths, e) {
          ths.$nextTick(() => {
            for (let i = 0; i < ths.$parent.$parent.$children.length; i++) {
              if (ths.$parent.$parent.$children[i].option.name === 'ActivityLabel') {
                ths.$parent.$parent.$children[i].visible = e === 'hd' || e === 'zb'
              }
              if (ths.$parent.$parent.$children[i].option.name === 'link') {
                ths.$parent.$parent.$children[i].visible = e !== 'hd' && e !== 'cg' && e !== 'zq' && e !== 'tp'
              }
            }
          })
        }
      }
    },
    ...labelOptions()
  ]
}
